/**
 * The Community Project
 * Copyright Team1 Productions
 * 
 * Joshua Amick
 * Stephen Cunningham
 * Thema Davis
 * Tomika Dawson
 * Lucie DeCristofaro
 * 
 * All Rights Reserved.
 */

package com.util;

import org.displaytag.decorator.TableDecorator;

import com.domain.Announcement;
import com.domain.Email;
import com.domain.Event;
import com.domain.User;

public class DisplayTagWrapper extends TableDecorator{
	
	public DisplayTagWrapper(){}
	
	public String getApproveUser(){
		User user = (User)getCurrentRowObject();
		return "<a href=\"Approve.do?type=user&objKeyId="+ user.getKeyId().toString() +"&approved=true\">Approve</a>";
	}
	
//	public String getDetailsUser(){
//		ListObject lObject= (ListObject)getCurrentRowObject();
//		int lIndex= getListIndex();
//		return "&lt;a href=\"details.jsp?index=" + lIndex + "\">" + lObject.getId() + "&lt;/a>";
//	}
//
//
	public String getDenyUser(){
		User user = (User)getCurrentRowObject();
		return "<a href=\"Approve.do?type=user&objKeyId="+ user.getKeyId().toString() +"&approved=false\">Deny</a>";
	}
	
	public String getDeleteUser(){
		User user = (User)getCurrentRowObject();
		return "<a href=\"Forward.do?loc=delete&type=user&objKeyId="+ user.getKeyId().toString() +"\">Delete</a>";
	}
	
	public String getDeleteEvent(){
		Event event = (Event)getCurrentRowObject();
		return "<a href=\"Forward.do?loc=delete&type=event&objKeyId="+ event.getKeyId().toString() +"\">Delete</a>";
	}
	
	public String getDeleteAnnouncement(){
		Announcement announcement = (Announcement)getCurrentRowObject();
		return "<a href=\"Forward.do?loc=delete&type=announcement&objKeyId="+ announcement.getKeyId().toString() +"\">Delete</a>";
	}
	
	public String getEditUser(){
		User user = (User)getCurrentRowObject();
		return "<a href=\"Forward.do?loc=createUser&type=user&objKeyId="+ user.getKeyId().toString() +"\">Edit</a>";
	}
	
	public String getEditEvent(){
		Event event = (Event)getCurrentRowObject();
		return "<a href=\"Forward.do?loc=createAnnouncement&type=event&objKeyId="+ event.getKeyId().toString() +"\">Edit</a>";
	}
	
	public String getEditAnnouncement(){
		Announcement announcement = (Announcement)getCurrentRowObject();
		return "<a href=\"Forward.do?loc=createAnnouncement&type=announcement&objKeyId="+ announcement.getKeyId().toString() +"\">Edit</a>";
	}
	
	public String getViewProfile(){
		User user = (User)getCurrentRowObject();
		if(user.getProfile().isPublicViewable()){
			return "<a href=\"Forward.do?loc=viewProfile&objKeyId="+ user.getKeyId().toString() +"\">View</a>";
		}
		else return "N/A";
	}
	
	public String getApproveEvent(){
		Event event= (Event)getCurrentRowObject();
		return "<a href=\"Approve.do?type=event&objKeyId="+ event.getKeyId().toString() +"&approved=true\">Approve</a>";
	}
	
//	public String getDetailsEvent(){
//		ListObject lObject= (ListObject)getCurrentRowObject();
//		int lIndex= getListIndex();
//		return "&lt;a href=\"details.jsp?index=" + lIndex + "\">" + lObject.getId() + "&lt;/a>";
//	}


	public String getDenyEvent(){
		Event event= (Event)getCurrentRowObject();
		return "<a href=\"Approve.do?type=event&objKeyId="+ event.getKeyId().toString() +"&approved=false\">Deny</a>";
	}
	
	public String getApproveAnnouncement(){
		Announcement announcement = (Announcement)getCurrentRowObject();
		return "<a href=\"Approve.do?type=announcement&objKeyId="+ announcement.getKeyId().toString() +"&approved=true\">Approve</a>";
	}
	
//	public String getDetailsAnnouncement(){
//		ListObject lObject= (ListObject)getCurrentRowObject();
//		int lIndex= getListIndex();
//		return "&lt;a href=\"details.jsp?index=" + lIndex + "\">" + lObject.getId() + "&lt;/a>";
//	}


	public String getDenyAnnouncement(){
		Announcement announcement = (Announcement)getCurrentRowObject();
		return "<a href=\"Approve.do?type=announcement&objKeyId="+ announcement.getKeyId().toString() +"&approved=false\">Deny</a>";
	}
	
	public String getApproveEmail(){
		Email email = (Email)getCurrentRowObject();
		return "<a href=\"Approve.do?type=email&objKeyId="+ email.getKeyId().toString() +"&approved=true\">Approve</a>";
	}
	
//	public String getDetailsEmail(){
//		ListObject lObject= (ListObject)getCurrentRowObject();
//		int lIndex= getListIndex();
//		return "&lt;a href=\"details.jsp?index=" + lIndex + "\">" + lObject.getId() + "&lt;/a>";
//	}


	public String getDenyEmail(){
		Email email = (Email)getCurrentRowObject();
		return "<a href=\"Approve.do?type=email&objKeyId="+ email.getKeyId().toString() +"&approved=false\">Deny</a>";
	}
	
}
